import { certDirectory, publicKeyName } from '../config/commonConfig'
import { loadKey } from '../utils/key'

export const getPublicKey = async (req, res) => {
  try {
    let publickey = loadKey(`${certDirectory}/${publicKeyName}`)
    res.json({
      status: 200,
      message: 'success',
      data: publickey
    })
  } catch (error) {
    res.json({
      status: 501,
      message: '公钥不存在！',
      data: null
    })
  }
}
